<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link href="layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="layui/css/index.css" rel="stylesheet" type="text/css">

</head>
<body>
  <div class="a">
    <div class="b"></div>
    <div class="c">
      <div class="d">
        <h1>登录/注册</h1>
        <form th:action="@{/GradeChoose}"  name="my_form" onsubmit="return check_form(this)">
          <input type="text" name="username" class="e" placeholder="用户名" id="user">
          <input type="password" class="e" name="password" placeholder="密码" id="pwd">
          <a href="#" class="f">注册</a>
          <a href="#" class="f">忘记密码</a>
          <input type="submit" name=“entry” value="登录" class="g" id="sub">
      </form>
      </div>
    </div>
  </div>
  <script src="layui/layui.js"></script>
  <script>
    function check_form(form) {
      if (form.username.value == "") {
        alert("用户名为空")
        form.username.focus();
        return false;
      }
      if (form.password.value == "") {
        alert("密码为空")
        form.password.focus();
        return false;
      }
      if(form.username.value !='admin'&&form.password.value=='123'){
        alert("用户名错误")
        form.username.focus();
        return false;
      }
      if(form.password.value!='123'&&form.username.value =='admin'){
        alert("密码错误")
        form.password.focus();
        return false;
      }
      if(form.password.value!='123'&&form.username.value !='admin'){
        alert("用户名和密码错误")
        form.password.focus();
        return false;
      }
      return true;
    }
  </script>
</body>
</html>